home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CHyperText 1.2 / CDemoDialog.cp next >
Encoding:
Text File  |  1994-11-30  |  3.8 KB  |  145 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  CDemoDialog.cp
  3.  
  4.         
  5.     SUPERCLASS = CDLOGDirector
  6.     
  7.     Copyright © 1994 Johns Hopkins University. All rights reserved.
  8.     
  9.     Original Author:     Martin R. Wachter        email:    mrw@welchgate.welch.jhu.edu
  10.     Created:            4/4/94                    by:        mrw            TCL Version:    1.1.3
  11.     Modified:            4/5/94                    by:        mrw            TCL Version:    1.1.3
  12.  
  13.  ******************************************************************************/
  14.  
  15. #include "CDemoDialog.h"
  16. #include "CDialog.h"
  17. #include "HyperDemoCommands.h"
  18. #include <CIconPane.h>
  19. #include <CHyperText.h>
  20.  
  21. #define    kDemoDialogID            1024
  22.  
  23. enum        /* window item numbers    */
  24. {
  25.     kOKBtn = 1,
  26.     hyText,
  27.     asIcon,
  28.     paintIcon,
  29.     commIcon,
  30.     mailIcon
  31. };
  32.  
  33. extern CApplication    *gApplication;
  34.  
  35. /******************************************************************************
  36.  IDemoDialog
  37. ******************************************************************************/
  38.  
  39. void CDemoDialog::IDemoDialog( void)
  40. {
  41.     
  42.     CDLOGDirector::IDLOGDirector( kDemoDialogID, gApplication);
  43.     
  44.     ((CDialog*)itsWindow)->SetDefaultCmd( cmdOK);
  45.  
  46.     itsHyperText = (CHyperText*) itsWindow->FindViewByID( hyText);
  47.     itsHyperText->SetClickCmd(cmdHyperHit);
  48.     
  49.     itsASIcon = (CIconPane*) itsWindow->FindViewByID( asIcon);
  50.     itsPaintIcon = (CIconPane*) itsWindow->FindViewByID( paintIcon);
  51.     itsCommIcon = (CIconPane*) itsWindow->FindViewByID( commIcon);
  52.     itsMailIcon = (CIconPane*) itsWindow->FindViewByID( mailIcon);
  53.     
  54.     // disable cHaveIconDispatch because of a BUG in CIconPane in TCL 1.1.3
  55.     itsASIcon->cHaveIconDispatch = FALSE;
  56.     itsPaintIcon->cHaveIconDispatch = FALSE;
  57.     itsCommIcon->cHaveIconDispatch = FALSE;
  58.     itsMailIcon->cHaveIconDispatch = FALSE;
  59.     
  60. }    /* CDemoDialog::IDemoDialog */
  61.  
  62. /******************************************************************************
  63.  DoCommand
  64. ******************************************************************************/
  65.  
  66. void CDemoDialog::DoCommand( long aCmd)
  67. {
  68. Str255    sTemp;
  69. Rect    r;
  70. long    fticks;
  71.  
  72.     CopyPString(itsHyperText->lastHyperword, sTemp);
  73.     
  74.     switch (aCmd){
  75.         case cmdHyperHit:
  76.             if(EqualString(sTemp,"\papplescript",FALSE,FALSE)){
  77.                 itsASIcon->Prepare();
  78.                 itsASIcon->DrawIcon(TRUE);
  79.                 Delay(5,&fticks);
  80.                 itsASIcon->DrawIcon(FALSE);
  81.                 Delay(5,&fticks);
  82.                 itsASIcon->DrawIcon(TRUE);
  83.                 Delay(5,&fticks);
  84.                 itsASIcon->DrawIcon(FALSE);
  85.             }
  86.             else if(EqualString(sTemp,"\ppainting",FALSE,FALSE)){
  87.                 itsPaintIcon->Prepare();
  88.                 itsPaintIcon->DrawIcon(TRUE);
  89.                 Delay(5,&fticks);
  90.                 itsPaintIcon->DrawIcon(FALSE);
  91.                 Delay(5,&fticks);
  92.                 itsPaintIcon->DrawIcon(TRUE);
  93.                 Delay(5,&fticks);
  94.                 itsPaintIcon->DrawIcon(FALSE);
  95.             }
  96.             else if(EqualString(sTemp,"\pcommunication",FALSE,FALSE)){
  97.                 itsCommIcon->Prepare();
  98.                 itsCommIcon->DrawIcon(TRUE);
  99.                 Delay(5,&fticks);
  100.                 itsCommIcon->DrawIcon(FALSE);
  101.                 Delay(5,&fticks);
  102.                 itsCommIcon->DrawIcon(TRUE);
  103.                 Delay(5,&fticks);
  104.                 itsCommIcon->DrawIcon(FALSE);
  105.             }
  106.             else if(EqualString(sTemp,"\pmail",FALSE,FALSE)){
  107.                 itsMailIcon->Prepare();
  108.                 itsMailIcon->DrawIcon(TRUE);
  109.                 Delay(5,&fticks);
  110.                 itsMailIcon->DrawIcon(FALSE);
  111.                 Delay(5,&fticks);
  112.                 itsMailIcon->DrawIcon(TRUE);
  113.                 Delay(5,&fticks);
  114.                 itsMailIcon->DrawIcon(FALSE);
  115.             }
  116.         break;
  117.             
  118.         default: 
  119.                 inherited::DoCommand( aCmd);
  120.                 break;
  121.     }
  122.                 
  123. }    /* CDemoDialog::DoCommand */
  124.  
  125. /******************************************************************************
  126.  ProviderChanged
  127. ******************************************************************************/
  128.  
  129. void CDemoDialog::ProviderChanged( CCollaborator *aProvider, long reason,
  130.                                         void *info)
  131. {
  132.     inherited::ProviderChanged( aProvider, reason, info);
  133.  
  134. }    /* CDemoDialog::ProviderChanged */
  135.  
  136. /******************************************************************************
  137.  Dispose
  138. ******************************************************************************/
  139.  
  140. void CDemoDialog::Dispose( void)
  141. {
  142.     inherited::Dispose();
  143. }
  144.  
  145.